#ifndef _TYPES_H
#define _TYPES_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <stddef.h>
#include <stdarg.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>

#define SIZE_1K         (1024u)
#define SIZE_1M         (1024*1024u)
#define DEV_ADDR_LEN    (20)

typedef long            base_t;      /* Nbit CPU related date type */
typedef unsigned long   ubase_t;     /* Nbit unsigned CPU related data type */

typedef uint8_t         u8;
typedef uint16_t        u16;
typedef uint32_t        u32;
typedef uint64_t        u64;
typedef int8_t          s8;
typedef int16_t         s16;
typedef int32_t         s32;
typedef int64_t         s64;

typedef u32             ev_time_t;

struct list_head
{
    struct list_head *next, *prev;
};

typedef struct {
    u8 len;
    u8 addr[DEV_ADDR_LEN];
} dev_addr_t;

typedef struct {
    u32 len;
    void *data;
} data_t;

/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
    void  *base;
    size_t len;
} ev_buf_t;

struct observer_struct
{
    struct list_head entry;

    void (*update)(struct observer_struct *ob, void *arg);
};
struct subject_struct
{
    struct list_head head;
};

#include "net/ip_addr.h"

#ifdef __cplusplus
}
#endif
#endif
